home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / CodeFragments.a < prev    next >
Encoding:
Text File  |  1994-11-11  |  6.0 KB  |  230 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        CodeFragments.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
  18. __CODEFRAGMENTS__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24. ;        include 'ConditionalMacros.a'                                ;
  25.  
  26.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  27.     include 'Files.a'
  28.     ENDIF
  29. ;        include 'MixedMode.a'                                        ;
  30. ;        include 'OSUtils.a'                                        ;
  31. ;            include 'Memory.a'                                        ;
  32.  
  33. kCFragResourceType                EQU        'cfrg'
  34. kCFragResourceID                EQU        0
  35. kCFragLibraryFileType            EQU        'shlb'
  36.  
  37. kPowerPCCFragArch                EQU        'pwpc'
  38. kMotorola68KCFragArch            EQU        'm68k'
  39. kAnyCFragArch                    EQU        $3F3F3F3F
  40.  
  41. kLoadCFrag                        EQU        $01                    ; Try to use existing copy, load if not found.
  42. kFindCFrag                        EQU        $02                    ; Try find an existing copy, don't load if not found.
  43. kNewCFragCopy                    EQU        $05                    ; Load a new copy whether one already exists or not.
  44. kInplaceCFrag                    EQU        $80                    ; Use data sections directly in the container.
  45.  
  46. kUnresolvedCFragSymbolAddress    EQU        0
  47.  
  48. kCodeCFragSymbol                EQU        0
  49. kDataCFragSymbol                EQU        1
  50. kTVectorCFragSymbol                EQU        2
  51. kTOCCFragSymbol                    EQU        3
  52. kGlueCFragSymbol                EQU        4
  53.  
  54. kImportLibraryCFrag                EQU        0                    ; Standard CFM import library.
  55. kApplicationCFrag                EQU        1                    ; Macintosh application.
  56. kDropInAdditionCFrag            EQU        2                    ; Private extension to an application or library.
  57.  
  58. kIsCompleteCFrag                EQU        0                    ; A "base" fragment, not an update.
  59. kFirstCFragUpdate                EQU        1                    ; The first update, others are numbered 2, 3, ...
  60.  
  61. kMemoryCFragLocator                EQU        0                    ; Container is already addressable.
  62. kDataForkCFragLocator            EQU        1                    ; Container is in a file's data fork.
  63. kResourceCFragLocator            EQU        2                    ; Container is in a file's resource fork.
  64.  
  65. kCFragGoesToEOF                    EQU        0
  66.  
  67. CFragOldMemoryLocator     RECORD    0
  68. address                     ds.l    1
  69. length                     ds.l    1
  70. inPlace                     ds.b    1
  71. reserved3a                 ds.b    3                                    ; ! Do not use this!
  72. sizeof                     EQU    12
  73.                         ENDR
  74.  
  75. CFragHFSDiskFlatLocator RECORD    0
  76. fileSpec                 ds.l    1
  77. offset                     ds.l    1
  78. length                     ds.l    1
  79. sizeof                     EQU    12
  80.                         ENDR
  81.  
  82. ; ! This must have a file specification at the same offset as a data fork locator!
  83. CFragHFSSegmentedLocator RECORD    0
  84. fileSpec                 ds.l    1
  85. rsrcType                 ds.l    1
  86. rsrcID                     ds.w    1
  87. reserved2a                 ds.w    1                                    ; ! Do not use this!
  88. sizeof                     EQU    12
  89.                         ENDR
  90.  
  91. CFragHFSLocator         RECORD    0
  92. where                     ds.l    1                                    ; Really of type CFragLocatorKind.
  93. VariantLevel0Begin        EQU    *
  94. onDisk                     ds        CFragHFSDiskFlatLocator            ; First so debugger shows this form.
  95.                         ORG        VariantLevel0Begin
  96. inMem                     ds.l    3
  97.                         ORG        VariantLevel0Begin
  98. inSegs                     ds.l    3
  99. sizeof                     EQU    16
  100.                         ENDR
  101.  
  102. ; -------------------------------------------------------------------------------------------
  103. ; The parameter block passed to fragment initialization functions.  The locator and name
  104. ; pointers are valid only for the duration of the initialization routine.  I.e. if you want
  105. ; to save the locator or name, save the contents, not the pointers.  Initialization routines
  106. ; take one parameter, a pointer to the parameter block, and return a success/failure result.
  107. ; ! Note that the initialization function returns an OSErr.  Any result other than noErr will
  108. ; ! cause the entire load to be aborted at that point.
  109. CFragInitBlock             RECORD    0
  110. contextID                 ds.l    1
  111. closureID                 ds.l    1
  112. connectionID             ds.l    1
  113. fragLocator                 ds.l    4
  114. libName                     ds.l    1
  115. reserved4a                 ds.l    1                                    ; ! Do not use this!
  116. reserved4b                 ds.l    1                                    ; ! Do not use this!
  117. reserved4c                 ds.l    1                                    ; ! Do not use this!
  118. reserved4d                 ds.l    1                                    ; ! Do not use this!
  119. sizeof                     EQU    48
  120.                         ENDR
  121.  
  122. ; §
  123. ; ===========================================================================================
  124. ; Routines
  125. ; ========
  126.     IF GENERATING68K THEN
  127.         Macro
  128.         _GetSharedLibrary
  129.             move.w    #$0001,-(sp)
  130.             dc.w     $AA5A
  131.         EndM
  132.     ELSE
  133.         IMPORT    GetSharedLibrary
  134.     ENDIF
  135.  
  136.     IF GENERATING68K THEN
  137.         Macro
  138.         _GetDiskFragment
  139.             move.w    #$0002,-(sp)
  140.             dc.w     $AA5A
  141.         EndM
  142.     ELSE
  143.         IMPORT    GetDiskFragment
  144.     ENDIF
  145.  
  146.     IF GENERATING68K THEN
  147.         Macro
  148.         _GetMemFragment
  149.             move.w    #$0003,-(sp)
  150.             dc.w     $AA5A
  151.         EndM
  152.     ELSE
  153.         IMPORT    GetMemFragment
  154.     ENDIF
  155.  
  156.     IF GENERATING68K THEN
  157.         Macro
  158.         _CloseConnection
  159.             move.w    #$0004,-(sp)
  160.             dc.w     $AA5A
  161.         EndM
  162.     ELSE
  163.         IMPORT    CloseConnection
  164.     ENDIF
  165.  
  166.     IF GENERATING68K THEN
  167.         Macro
  168.         _FindSymbol
  169.             move.w    #$0005,-(sp)
  170.             dc.w     $AA5A
  171.         EndM
  172.     ELSE
  173.         IMPORT    FindSymbol
  174.     ENDIF
  175.  
  176.     IF GENERATING68K THEN
  177.         Macro
  178.         _CountSymbols
  179.             move.w    #$0006,-(sp)
  180.             dc.w     $AA5A
  181.         EndM
  182.     ELSE
  183.         IMPORT    CountSymbols
  184.     ENDIF
  185.  
  186.     IF GENERATING68K THEN
  187.         Macro
  188.         _GetIndSymbol
  189.             move.w    #$0007,-(sp)
  190.             dc.w     $AA5A
  191.         EndM
  192.     ELSE
  193.         IMPORT    GetIndSymbol
  194.     ENDIF
  195.  
  196.     IF OLDROUTINENAMES  THEN
  197.  
  198. kPowerPCArch                    EQU        kPowerPCCFragArch
  199. kMotorola68KArch                EQU        kMotorola68KCFragArch
  200. kAnyArchType                    EQU        kAnyCFragArch
  201. kNoLibName                        EQU        0
  202. kNoConnectionID                    EQU        0
  203. kLoadLib                        EQU        kLoadCFrag
  204. kFindLib                        EQU        kFindCFrag
  205. kLoadNewCopy                    EQU        kNewCFragCopy
  206. kUseInPlace                        EQU        kInplaceCFrag
  207. kCodeSym                        EQU        kCodeCFragSymbol
  208. kDataSym                        EQU        kDataCFragSymbol
  209. kTVectSym                        EQU        kTVectorCFragSymbol
  210. kTOCSym                            EQU        kTOCCFragSymbol
  211. kGlueSym                        EQU        kGlueCFragSymbol
  212. kInMem                            EQU        kMemoryCFragLocator
  213. kOnDiskFlat                        EQU        kDataForkCFragLocator
  214. kOnDiskSegmented                EQU        kResourceCFragLocator
  215. kIsLib                            EQU        kImportLibraryCFrag
  216. kIsApp                            EQU        kApplicationCFrag
  217. kIsDropIn                        EQU        kDropInAdditionCFrag
  218. kFullLib                        EQU        kIsCompleteCFrag
  219. kUpdateLib                        EQU        kFirstCFragUpdate
  220. kCFMRsrcType                    EQU        kCFragResourceType
  221. kCFMRsrcID                        EQU        kCFragResourceID
  222. kSHLBFileType                    EQU        kCFragLibraryFileType
  223. kUnresolvedSymbolAddress        EQU        kUnresolvedCFragSymbolAddress
  224.  
  225. kPowerPC                        EQU        kPowerPCCFragArch
  226. kMotorola68K                    EQU        kMotorola68KCFragArch
  227.  
  228.     ENDIF
  229.     ENDIF ; __CODEFRAGMENTS__
  230.